package netty.io.demo.NIO;

import netty.io.demo.NIO.handle.NIOServerHandle;

import java.io.IOException;
import java.net.InetSocketAddress;

public class NIOServer {
  
  private static NIOServerHandle serverHandle;
  
  public static void start() throws IOException {
    if (serverHandle != null) {
      serverHandle.stop();
    }
    serverHandle = new NIOServerHandle(new InetSocketAddress(10001));
    
    // 通过一个单线程 启动 nio server 端
    new Thread(serverHandle).start();
  }
  
  public static void main(String[] args) throws IOException {
    start();
  }
}
